{extend name="public/base"}
{block name='main'}

<style type="text/css">
    #imgdiv{margin-top: 10px;}
</style>
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
    <input type="hidden" name="id" value="{$info.id|default=''}" />
    <div class="layui-form-item">
        <label class="layui-form-label">专辑名称</label>
        <div class="layui-input-block">
            <input type="text" name="title" id="title" placeholder="请输入" class="layui-input" value="{$info.title|default=''}">
        </div>
    </div>
    <div class="layui-form-item" id="ad_image">
        <label class="layui-form-label">专辑封面</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn layui-btn-primary" id="upimg"><i class="layui-icon"></i>只允许图片文件</button>
        </div>
        <div class="layui-input-block" id="imgdiv" {eq name="$info.img|default=''" value=""}style="display: none;margin-top: 10px;"{/eq} >
        <img src={eq name="$info.img|default=''" value=''}{else/}{:upload_url($info['img'], 'album')}{/eq}  height="36" id="imgval" >
    </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">专辑简介</label>
        <div class="layui-input-block">
            <textarea name="intro" class="layui-textarea">{$info.intro|default=''}</textarea>
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label">是否置顶</label>
        <div class="layui-input-block">
            <input type="radio" name="zhiding" value="1" title="是"   {eq name="info.zhiding|default='1'" value="1"}checked="checked"{/eq}>
            <input type="radio" name="zhiding" value="0" title="否"   {eq name="info.zhiding|default='0'" value="0"}checked="checked"{/eq}>
        </div>
    </div>

    <div class="layui-form-item" pane>
        <label class="layui-form-label">是否启用</label>
        <div class="layui-input-block">
            <input type="radio" title="是" name="status" value="1"  {eq name="info.status|default='1'" value="1"}checked="checked"{/eq}>
            <input type="radio" title="否" name="status" value="0"  {eq name="info.status|default='0'" value="0"}checked="checked"{/eq}>
        </div>
    </div>

    <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="content_edit">提交保存</button>
        </div>
    </div>
    <input type="hidden" name="img" id="J_img" value="{$info.img|default=''}">
</form>
<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
    //Demo
    layui.use(['layer','jquery','form','upload'], function () {
        // 操作对象
        var layer = layui.layer,$ = layui.jquery,form = layui.form, upload = layui.upload;

        //上传图片
        upload.render({
            elem: '#upimg'
            ,url: "{:url('album/ajax_upload_img')}"
            ,accept:'file'					//文件类型，不写默认是images，file表示全类型
            ,done: function(res, index, upload){
                if (res.status == 1) {
                    layer.msg('上传成功',{time:1800});
                    $('#J_img').val(res.info);
                    $('#imgdiv').show();
                    $('#imgval').show().attr('src',res.img_url);
                }else {
                    layer.msg('上传失败',{time:1800});
                }
            }
        });
        Oper.initUpdate(layui, '专辑', 'content_edit', 'album/edit');
    });
</script>
{/block}